package com.whisperly.echotalk.starryb.utils;

import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.whisperly.echotalk.bllmodel.ChatWithUser;
import com.whisperly.echotalk.bllmodel.UserWithChat;

import java.util.ArrayList;
import java.util.List;

public class DatabaseHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "BlinkChat.db";
    private static final String TABLE_NAME_FEED = "CREATE TABLE feedback (id INTEGER PRIMARY KEY AUTOINCREMENT,feedbackType TEXT,feedbackContent TEXT)";
    public DatabaseHelper(Context context) {
        super(context, DATABASE_NAME, null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(TABLE_NAME_FEED);
    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
    public boolean insertFeedback(String feedbackType, String feedbackContent) {
        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues contentValues = new ContentValues();
        contentValues.put("feedbackType", feedbackType);
        contentValues.put("feedbackContent", feedbackContent);
        return db.insert("feedback", null, contentValues) > 0;
    }

    public void deleteFeedback() {
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete("feedback",null,null);
    }
}
